import axios from "axios";
const put = options => {

  return new Promise((resolve, reject) => {

    const defaultOptions = {};
    const newOptions = {
      ...defaultOptions,
      ...options
    };
    newOptions.headers = {
      ...newOptions.headers
    };

    axios.put(newOptions.url, newOptions.data, {
      headers: newOptions.headers
    }).then(res => {
      if(res){
        resolve(res.data);
      }
    }).catch(err => {
      if(err.response){
        if(err.response.status!='401'||err.response.status!='403'){
          reject(err);
        }
      }else{
        reject(err);
      }
    })

  });
};

export default put
